<template>
  <div class="myDiv">
     <!-- 军队无军籍离退休退职职工 -->
    <el-card class="box-card secordCard" shadow="never">
      <div slot="header" class="clearfix">
        <span>军队无军籍离退休退职职工信息</span>
        <!-- <el-button style="float: right; padding: 3px 0" type="text">收起</el-button> -->
      </div>
      <div>
        <el-form ref="form" :model="form" :rules="rules" class="formWidth" label-width="160px">
        <el-row :gutter="10">
          <el-col :span="8">
            <el-form-item label="参加工作或入伍时间" prop="enlistedDate">
              <el-date-picker clearable size="small"
                v-model="form.enlistedDate"
                type="date"
                value-format="yyyy-MM-dd"
                placeholder="选择参加工作或入伍时间">
              </el-date-picker>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="成为军队职工方式" prop="participationMode">
              <el-select v-model="form.participationMode" placeholder="请选择成为军队职工方式">
                <el-option
                  v-for="dict in participationModeOptions"
                  :key="dict.dictValue"
                  :label="dict.dictLabel"
                  :value="parseInt(dict.dictValue)"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="离休退休时间" prop="retirementDate">
              <el-date-picker clearable size="small"
                v-model="form.retirementDate"
                type="date"
                value-format="yyyy-MM-dd"
                placeholder="选择离休退休时间">
              </el-date-picker>
            </el-form-item>
           </el-col>
           <el-col :span="8">
            <el-form-item label="原单位" prop="originalUnitName">
              <el-input v-model="form.originalUnitName" placeholder="请输入原单位" />
            </el-form-item>
          </el-col>
          <el-col :span="8">
           <el-form-item label="原职级" prop="originalRank">
              <el-input v-model="form.originalRank" placeholder="请输入原职级" />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="离休退休证件号码" prop="retirementCertificateCode">
              <el-input v-model="form.retirementCertificateCode" placeholder="请输入离休退休证件号码" />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="获得荣誉称号情况" prop="honour">
              <el-select v-model="form.honour" placeholder="请选择获得荣誉称号情况">
                <el-option
                  v-for="dict in honourOptions"
                  :key="dict.dictValue"
                  :label="dict.dictLabel"
                  :value="parseInt(dict.dictValue)"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="是否伤残" prop="isHandicapped">
              <el-select v-model="form.isHandicapped" placeholder="请选择是否伤残">
                <el-option
                  v-for="dict in isHandicappedOptions"
                  :key="dict.dictValue"
                  :label="dict.dictLabel"
                  :value="parseInt(dict.dictValue)"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="伤残等级" prop="handicappedLevel">
              <el-select v-model="form.handicappedLevel" placeholder="请选择伤残等级">
                <el-option
                  v-for="dict in handicappedLevelOptions"
                  :key="dict.dictValue"
                  :label="dict.dictLabel"
                  :value="dict.dictValue"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="安置计划批次" prop="arrangeBatch">
              <el-select v-model="form.arrangeBatch" placeholder="请选择安置计划批次">
                <el-option
                  v-for="dict in arrangeBatchOptions"
                  :key="dict.dictValue"
                  :label="dict.dictLabel"
                  :value="parseInt(dict.dictValue)"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="安置地" prop="arrangePlace">
              <el-input v-model="form.arrangePlace" placeholder="请输入安置地 省市县/区" />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="接收年月" prop="receiveDate">
              <el-input v-model="form.receiveDate" placeholder="请输入接收年月" />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="个人月均离退休金总额" prop="monthPension">
              <el-input v-model="form.monthPension" placeholder="请输入个人月均离退休金总额" />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="家庭购买房改住房情况" prop="houseSituation">
              <el-select v-model="form.houseSituation" placeholder="请选择家庭购买房改住房情况">
                <el-option
                  v-for="dict in houseSituationOptions"
                  :key="dict.dictValue"
                  :label="dict.dictLabel"
                  :value="parseInt(dict.dictValue)"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="所购房改住房性质" prop="houseType">
              <el-select v-model="form.houseType" placeholder="请选择所购房改住房性质">
                <el-option
                  v-for="dict in houseTypeOptions"
                  :key="dict.dictValue"
                  :label="dict.dictLabel"
                  :value="parseInt(dict.dictValue)"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="房改住房购房主体" prop="houseBelong">
              <el-select v-model="form.houseBelong" placeholder="请选择房改住房购房主体">
                <el-option
                  v-for="dict in houseBelongOptions"
                  :key="dict.dictValue"
                  :label="dict.dictLabel"
                  :value="parseInt(dict.dictValue)"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="所购房改住房实际地址" prop="houseSpecific">
              <el-input v-model="form.houseSpecific" placeholder="请输入实际地址 填写至门牌号" />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="所购房改住房建筑面积 " prop="houseAcreage">
              <el-input v-model="form.houseAcreage" placeholder="请输入所购房改住房建筑面积 " />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="安置单位性质" prop="arrangeUnitType">
              <el-input v-model="form.arrangeUnitType" placeholder="请输入安置单位性质" />
            </el-form-item>
          </el-col>
        </el-row>
       </el-form>
      </div>
    </el-card>
  </div>
</template>

<script>
export default {
  name: "nomilitaryCard",
  data(){
    return {
      // 成为军队职工方式字典
      participationModeOptions: [],
      // 获得荣誉称号情况字典
      honourOptions: [],
      // 是否伤残字典
      isHandicappedOptions: [],
      // 伤残等级字典
      handicappedLevelOptions: [],
      // 安置计划批次字典
      arrangeBatchOptions: [],
      // 家庭购买房改住房情况字典
      houseSituationOptions: [],
      // 所购房改住房性质字典
      houseTypeOptions: [],
      // 房改住房购房主体字典
      houseBelongOptions: [],
       // 表单参数
      form: {},
      // 表单校验
      rules: {
        enlistedDate: [
          { required: true, message: "参加工作或入伍时间不能为空", trigger: "blur" }
        ],
        participationMode: [
          { required: true, message: "成为军队职工方式不能为空", trigger: "change" }
        ],
        retirementDate: [
          { required: true, message: "离休退休时间不能为空", trigger: "blur" }
        ],
      }
    };
  },
  props:{
    soldierId: String,
  },
  mounted(){
    this.form.soldierId = this.soldierId
  },
   created() {
    this.getDicts("participation_mode").then(response => {
      this.participationModeOptions = response.data;
    });
    this.getDicts("honorary_title").then(response => {
      this.honourOptions = response.data;
    });
    this.getDicts("yes_or_no").then(response => {
      this.isHandicappedOptions = response.data;
    });
    this.getDicts("disability_level").then(response => {
      this.handicappedLevelOptions = response.data;
    });
    this.getDicts("arrange_ batch").then(response => {
      this.arrangeBatchOptions = response.data;
    });
    this.getDicts("house_situation").then(response => {
      this.houseSituationOptions = response.data;
    });
    this.getDicts("house_type").then(response => {
      this.houseTypeOptions = response.data;
    });
    this.getDicts("house_belong").then(response => {
      this.houseBelongOptions = response.data;
    });
  },
  methods:{
     validateForm(){
      return new Promise((resolve , reject) => {
        this.$refs.form.validate(valid => {
          if (valid) {
            resolve();
          } else reject();
        });
      })
     }
  },
}
</script>
<style lang="scss" scoped>
.box-card{
  margin-bottom: 16px;
}
::v-deep .secordCard .el-form-item__content {
   height: 36px;
}
</style>